import { View, Text } from 'react-native'
import React from 'react'
// 导入项目中的“页面/屏幕”对象
import AdminLogin from './screens/AdminLogin'
import MainMenu from './screens/MainMenu'
import ProductDetails from './screens/ProductDetails'
import ProductList from './screens/ProductList'
// 导入ReactNavigation提供的路由导航相关对象
import { NavigationContainer } from '@react-navigation/native'  //导航容器
import { createNativeStackNavigator } from '@react-navigation/native-stack' //栈式导航器

// 使用栈式导航器创建出“导航器(即路由词典)”和“屏幕(即路由)”对象
const {Navigator,Screen}=createNativeStackNavigator()
export default function App() {
  return (
    <NavigationContainer>
      <Navigator initialRouteName='login'>
        <Screen name="plist" component={ProductList} />
        <Screen 
        name="login" 
        component={AdminLogin} 
        options={{
          title:'管理员登录',
          headerStyle:{backgroundColor:'#0aa1ed'},
          headerTintColor:'#fff',
          headerTitleStyle:{fontWeight:'bold'}
          }}/>
        <Screen 
        name="menu" 
        component={MainMenu} 
        options={{
          title:'主菜单',
          headerStyle:{backgroundColor:'#0aa1ed'},
          headerTintColor:'#fff',
          headerTitleStyle:{fontWeight:'bold'}
        }}/>
        <Screen 
        name="pdetails" 
        component={ProductDetails} 
        options={{
          headerStyle:{backgroundColor:'#0aa1ed'},
          headerTintColor:'#fff',
          headerTitleStyle:{fontWeight:'bold'}
        }}/>
      </Navigator>
    </NavigationContainer>
  )
}